<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>注册</title>
    <style>
        body{
            padding:0;
            margin:0;
        }
        .regist{
            width:86%;
            margin:5% auto;
            background:#e8e8e8;
            border:1px solid #aaa;
            padding:4%;
        }
        .top{
            display:flex;
            justify-content:space-between;
        }
    </style>
</head>
<body>
    <div class="regist">
        <div class="top">
            <p>欢迎注册</p>
            <p>已有账号，<a href="#">立即登录</a></p>
        </div>
        <hr>   
        <div class="bottom_left">
            用户名称：<input type="text" id="uname"><br>
            用户密码：<input type="password" id="upwd"><br>
            确认密码：<input type="password" id="upwd-1"><br>
            联系方式：<input type="tel" id="phone"><br>
            <input type="radio" id="d1"><label for="d1">我已阅读</label><br>
            <input type="button" value="注册" onclick="reg()">
        </div>    
    </div>
    <script>
    function reg(){
        var xhr=new XMLHttpRequest();
        xhr.onreadystatechange=function(){
            if(xhr.readyState==4 && xhr.status==200){
                var result=xhr.respnoseText;
                    if(result=="success"){
                        alert("注册成功");
                    }else{
                        alert("注册失败");
                    }
            }
        }
        xhr.open("post","/mypro/reg",true);
        var formdata="uname="+uname.value+"&upwd="+upwd.value+"&phone="+phone.value;
        xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        xhr.send(formdata);
    }
    </script>
</body>
</html>